//package com.wx_shop.web.houtai.Controller.ShopkeerperController;
//
//
//import com.alibaba.fastjson.JSONObject;
//import com.wx_shop.web.houtai.utiltools.JSONObjectFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
//
//
//@RestController
//@CrossOrigin
//@RequestMapping("/shopkeeper")
//public class ShopkeeperController {
//
//    JSONObject json = JSONObjectFactory.getInstance();
//
//
//    @Autowired
//    private shopkeeperMapper shopkeeperMapper;
//
//    //查询用户列表
//    @GetMapping("/list")
//    public List<shopkeeper> findShopkeeperList(){
//        return shopkeeperMapper.findAll();
//    }
//
//    //根据id查询一个用户
//    @GetMapping("/{id}")
//    public shopkeeper findShopkeeperById(@PathVariable("id") String id){
//        return shopkeeperMapper.findById(id);
//    }
//
//    //验证账户是否有效
//    @GetMapping("/register/checkUsername")
//    public JSONObject findShopkeeperByUsername(@RequestParam("username") String username){
//
//        shopkeeper shopkeeper = shopkeeperMapper.findByUsername(username);
//
//        if(shopkeeper != null){
//            json.put("result","账号已被注册");
//        }else{
//            json.put("result","可以使用账号");
//        }
//
//        return json;
//
//    }
//
//    //验证账户是否有效
//    @GetMapping("/register/checkPhonenum")
//    public JSONObject findShopkeeperByPhonenum(@RequestParam("phone_num") String phonenum){
//
//        shopkeeper shopkeeper = shopkeeperMapper.findByPhonenum(phonenum);
//
//        if(shopkeeper != null){
//            json.put("result","手机号已被注册");
//        }else{
//            json.put("result","可以使用手机号");
//        }
//        return json;
//
//    }
//
//    //增加一个用户
//    //注册参数未定根据实际需求改动
//    @PostMapping("/shopkeeper/insert")
//    public JSONObject addShopkeeper(@RequestParam("username") String username,
//                             @RequestParam("password") String password,
//                             @RequestParam("phone_num") String phone_num){
//
//        int result =  shopkeeperMapper.addShopkeeper(username,password,phone_num);
//        if(result != 1){
//            json.put("result","FALSE");
//            json.put("shopkeeperinfo",shopkeeperMapper.findByUsername(username));
//        }else{
//            json.put("result","SUCCESS");
//            json.put("shopkeeperinfo",shopkeeperMapper.findByUsername(username));
//        }
//        return json;
//    }
//
//
//}
